define(function () {

    var self,
        app = win.app,
        searchData = {
            keyword: ''
        }
    ;

    app.newModule({

        init: function () {
            self = this;
            self._super({
                _refreshAutoInit: true //自动加载刷新控件
            }, win);
        },
        _initRefresh: function () { // 实例化刷新组件
            if (self._refreshIds.length == 0) {
                self._refreshIds = ['scroll1'];
            }
            this._super(win);
        },
        _refreshCb: function (goods) {// 刷新组件回调函授
            var _super = this._super;
            app.ajax({
                xurl: "api/wx/zsk/getListData",
                xdata: {
                    page:goods.page+1,
                    limit: goods.limit,
                    keyword: searchData.keyword
                },
                cb: function (result) {
                    if (result.ok) {
                        var data = result.data.data;

                        goods.data.pushArray(data, goods.page == 0);

                        _super({
                            obj: goods,
                            dataLen: data.length,
                            nodata: '无故障信息...'
                        });
                    }
                }
            });
        },
        _search: function (data) {
            searchData.keyword = data.keyword.trim();
            self._refresh();
        },
        _lazy: function () {
            this._super();
        },
        _ready: function () {
            Vue.component('customersitem', {
                template: app.getByid(doc, 'customersitem-template'),
                props: {
                    model: Array
                },
                methods: {
                    select: function (v) {
                        app.openPage({
                            src: "zsk/zsk-info.html",
                            args: {
                                item: v,
                                cb: function () {
                                    self._refresh();
                                }
                            }
                        });
                    }
                }
            });
        }
    });
});